import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/homeIndex.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    meta: {
      isShow: false,
    },
    redirect: '/mapDetails',
    children: [
      {
        path: '/mapDetails',
        name: 'mapDetails',
        component: () => import('../views/home/components/mapDetails.vue')
      },
      {
        path: '/mapView',
        name: 'mapView',
        component: () => import('../views/home/components/mapView.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'about',
    meta: {
      isShow: false,
    },
    redirect: "/a", // 默认展示第一个路由页面
    component: () => import('../views/about/aboutIndex.vue'),
    children: [
      {
        path: '/a',
        name: 'APage',
        meta: {
          isShow: true,
          title: '课程列表',
        },
        component: () => import('../views/about/components/APage.vue'),
      },
      {
        path: '/b',
        name: 'BPage',
        meta: {
          isShow: true,
          title: '讲师列表',
        },
        component: () => import('../views/about/components/BPage.vue'),
      }
    ],
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
